<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.19"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Modbus cpp: include/MB/modbusUtils.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Modbus cpp
   &#160;<span id="projectnumber">0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.19 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_f8aebf652183de33714d471cbd098255.html">MB</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">modbusUtils.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Modbus for c++ &lt;https://github.com/Mazurel/Modbus&gt;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// Copyright (c) 2020 Mateusz Mazur aka Mazurel</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// Licensed under: MIT License &lt;http://opensource.org/licenses/MIT&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160; </div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// This header files contain various utilities for Modbus Core library</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160; </div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;stdexcept&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html">   18</a></span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceMB_1_1utils.html">MB::utils</a> {</div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#aa34c557c9bf4c6bfeb86aa16b398de55">   22</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="namespaceMB_1_1utils.html#aa34c557c9bf4c6bfeb86aa16b398de55">MBErrorCode</a> : uint8_t {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;  <span class="comment">// Documentation modbus errors</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;  IllegalFunction = 0x01,</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;  IllegalDataAddress = 0x02,</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;  IllegalDataValue = 0x03,</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;  SlaveDeviceFailure = 0x04,</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;  Acknowledge = 0x05,</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  SlaveDeviceBusy = 0x06,</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;  NegativeAcknowledge = 0x07,</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;  MemoryParityError = 0x08,</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  GatewayPathUnavailable = 0x10,</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;  GatewayTargetDeviceFailedToRespond = 0x11,</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;  <span class="comment">// Custom modbus errors</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  ErrorCodeCRCError = 0b0111111,</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  InvalidCRC = 0b01111110,</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  InvalidByteOrder = 0b01111101,</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  InvalidMessageID = 0b01111100,</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;  ProtocolError = 0b01111011,</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;  ConnectionClosed = 0b01111010,</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;  Timeout = 0b01111001</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;};</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#a7aa22230ea192f06612fbc809fca2335">   46</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceMB_1_1utils.html#a7aa22230ea192f06612fbc809fca2335">isStandardErrorCode</a>(<a class="code" href="namespaceMB_1_1utils.html#aa34c557c9bf4c6bfeb86aa16b398de55">MBErrorCode</a> code) {</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  <span class="keywordflow">switch</span> (code) {</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  <span class="keywordflow">case</span> IllegalFunction:</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  <span class="keywordflow">case</span> IllegalDataAddress:</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="keywordflow">case</span> IllegalDataValue:</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;  <span class="keywordflow">case</span> SlaveDeviceFailure:</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;  <span class="keywordflow">case</span> Acknowledge:</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;  <span class="keywordflow">case</span> SlaveDeviceBusy:</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;  <span class="keywordflow">case</span> NegativeAcknowledge:</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  <span class="keywordflow">case</span> MemoryParityError:</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  <span class="keywordflow">case</span> GatewayPathUnavailable:</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  <span class="keywordflow">case</span> GatewayTargetDeviceFailedToRespond:</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;  <span class="keywordflow">case</span> ErrorCodeCRCError:</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  <span class="keywordflow">case</span> InvalidCRC:</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  <span class="keywordflow">case</span> InvalidByteOrder:</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  <span class="keywordflow">case</span> InvalidMessageID:</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  <span class="keywordflow">case</span> ProtocolError:</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="keywordflow">case</span> ConnectionClosed:</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="keywordflow">case</span> Timeout:</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;}</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#af467d314367c209ef830b2ae97393b6f">   72</a></span>&#160;<span class="keyword">inline</span> std::string <a class="code" href="namespaceMB_1_1utils.html#af467d314367c209ef830b2ae97393b6f">mbErrorCodeToStr</a>(<a class="code" href="namespaceMB_1_1utils.html#aa34c557c9bf4c6bfeb86aa16b398de55">MBErrorCode</a> code) noexcept {</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  <span class="keywordflow">switch</span> (code) {</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  <span class="keywordflow">case</span> IllegalFunction:</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Illegal function&quot;</span>;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  <span class="keywordflow">case</span> IllegalDataAddress:</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Illegal data address&quot;</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  <span class="keywordflow">case</span> IllegalDataValue:</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Illegal data value&quot;</span>;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  <span class="keywordflow">case</span> SlaveDeviceFailure:</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Slave device failure&quot;</span>;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  <span class="keywordflow">case</span> Acknowledge:</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Acknowledge&quot;</span>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  <span class="keywordflow">case</span> SlaveDeviceBusy:</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Slave device busy&quot;</span>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  <span class="keywordflow">case</span> NegativeAcknowledge:</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Negative acknowledge&quot;</span>;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;  <span class="keywordflow">case</span> MemoryParityError:</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Memory parity error&quot;</span>;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  <span class="keywordflow">case</span> GatewayPathUnavailable:</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Gateway path unavailable&quot;</span>;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  <span class="keywordflow">case</span> GatewayTargetDeviceFailedToRespond:</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Gateway target device failed to respond&quot;</span>;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  <span class="keywordflow">case</span> ErrorCodeCRCError:</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;CRC error code error&quot;</span>;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="keywordflow">case</span> InvalidCRC:</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Invalid CRC&quot;</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  <span class="keywordflow">case</span> InvalidByteOrder:</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Invalid byte order&quot;</span>;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;  <span class="keywordflow">case</span> InvalidMessageID:</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Invalid messageID (TCP/IP)&quot;</span>;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  <span class="keywordflow">case</span> ProtocolError:</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Protocol error (may be timeout)&quot;</span>;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <span class="keywordflow">case</span> ConnectionClosed:</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Connection is closed&quot;</span>;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  <span class="keywordflow">case</span> Timeout:</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Timeout&quot;</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Undefined Error&quot;</span>;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;  }</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;}</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">  114</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">MBFunctionCode</a> : uint8_t {</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="comment">// Reading functions</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  ReadDiscreteOutputCoils = 0x01,</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  ReadDiscreteInputContacts = 0x02,</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  ReadAnalogOutputHoldingRegisters = 0x03,</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  ReadAnalogInputRegisters = 0x04,</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="comment">// Single write functions</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  WriteSingleDiscreteOutputCoil = 0x05,</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  WriteSingleAnalogOutputRegister = 0x06,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <span class="comment">// Multiple write functions</span></div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;  WriteMultipleDiscreteOutputCoils = 0x0F,</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  WriteMultipleAnalogOutputHoldingRegisters = 0x10,</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160; </div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  <span class="comment">// User defined</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  Undefined = 0x00</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;};</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#a0b3590994f5ba26cd61929f5a394ab70">  134</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="namespaceMB_1_1utils.html#a0b3590994f5ba26cd61929f5a394ab70">MBFunctionType</a> { Read, WriteSingle, WriteMultiple };</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#ab24a81a029cf6c4765eab5d74b7d8dff">  137</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="namespaceMB_1_1utils.html#a0b3590994f5ba26cd61929f5a394ab70">MBFunctionType</a> <a class="code" href="namespaceMB_1_1utils.html#ab24a81a029cf6c4765eab5d74b7d8dff">functionType</a>(<span class="keyword">const</span> <a class="code" href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">MBFunctionCode</a> code) {</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <span class="keywordflow">switch</span> (code) {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteOutputCoils:</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;  <span class="keywordflow">case</span> ReadAnalogInputRegisters:</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteInputContacts:</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;  <span class="keywordflow">case</span> ReadAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="keywordflow">return</span> Read;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;  <span class="keywordflow">case</span> WriteSingleAnalogOutputRegister:</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  <span class="keywordflow">case</span> WriteSingleDiscreteOutputCoil:</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordflow">return</span> WriteSingle;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  <span class="keywordflow">case</span> WriteMultipleAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  <span class="keywordflow">case</span> WriteMultipleDiscreteOutputCoils:</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="keywordflow">return</span> WriteMultiple;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;The function code is undefined&quot;</span>);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;  }</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;}</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160; </div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#a8098c5bcb6c33b219bafdee42334e260">  156</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="namespaceMB_1_1utils.html#a8098c5bcb6c33b219bafdee42334e260">MBFunctionRegisters</a> {</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;  OutputCoils,</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;  InputContacts,</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;  HoldingRegisters,</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;  InputRegisters</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;};</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#ad967d0ef18fecbc1a231143db3793991">  164</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="namespaceMB_1_1utils.html#a8098c5bcb6c33b219bafdee42334e260">MBFunctionRegisters</a> <a class="code" href="namespaceMB_1_1utils.html#ad967d0ef18fecbc1a231143db3793991">functionRegister</a>(<span class="keyword">const</span> <a class="code" href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">MBFunctionCode</a> code) {</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;  <span class="keywordflow">switch</span> (code) {</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteOutputCoils:</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;  <span class="keywordflow">case</span> WriteSingleDiscreteOutputCoil:</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;  <span class="keywordflow">case</span> WriteMultipleDiscreteOutputCoils:</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keywordflow">return</span> OutputCoils;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteInputContacts:</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="keywordflow">return</span> InputContacts;</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;  <span class="keywordflow">case</span> ReadAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  <span class="keywordflow">case</span> WriteSingleAnalogOutputRegister:</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;  <span class="keywordflow">case</span> WriteMultipleAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    <span class="keywordflow">return</span> HoldingRegisters;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;  <span class="keywordflow">case</span> ReadAnalogInputRegisters:</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    <span class="keywordflow">return</span> InputRegisters;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;The function code is undefined&quot;</span>);</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;  }</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;}</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#aaf546a5a9bb27ee4f7300064d18d9a9e">  184</a></span>&#160;<span class="keyword">inline</span> std::string <a class="code" href="namespaceMB_1_1utils.html#aaf546a5a9bb27ee4f7300064d18d9a9e">mbFunctionToStr</a>(<a class="code" href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">MBFunctionCode</a> code) noexcept {</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;  <span class="keywordflow">switch</span> (code) {</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteOutputCoils:</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Read from output coils&quot;</span>;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;  <span class="keywordflow">case</span> ReadDiscreteInputContacts:</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Read from input contacts&quot;</span>;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  <span class="keywordflow">case</span> ReadAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Read from output registers&quot;</span>;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;  <span class="keywordflow">case</span> ReadAnalogInputRegisters:</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Read from input registers&quot;</span>;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;  <span class="keywordflow">case</span> WriteSingleAnalogOutputRegister:</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Write to single analog register&quot;</span>;</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;  <span class="keywordflow">case</span> WriteSingleDiscreteOutputCoil:</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Write to single coil&quot;</span>;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;  <span class="keywordflow">case</span> WriteMultipleAnalogOutputHoldingRegisters:</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Write to multiple holding registers&quot;</span>;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;  <span class="keywordflow">case</span> WriteMultipleDiscreteOutputCoils:</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Write to multiple output coils&quot;</span>;</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <span class="keywordflow">return</span> <span class="stringliteral">&quot;Undefined&quot;</span>;</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;  }</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;}</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160; </div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#a2057e90dfbefb2bc7cea23f6140d5a04">  208</a></span>&#160;<span class="keyword">inline</span> uint16_t <a class="code" href="namespaceMB_1_1utils.html#a2057e90dfbefb2bc7cea23f6140d5a04">bigEndianConv</a>(<span class="keyword">const</span> uint8_t *buf) {</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;  <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>uint16_t<span class="keyword">&gt;</span>(buf[1]) +</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;         (<span class="keyword">static_cast&lt;</span>uint16_t<span class="keyword">&gt;</span>(buf[0]) &lt;&lt; 8); <span class="comment">// NOLINT(hicpp-signed-bitwise)</span></div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;}</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160; </div>
<div class="line"><a name="l00214"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#aa419ed339bbdacd4108fb5cc1cd14539">  214</a></span>&#160;<span class="keyword">inline</span> uint16_t <a class="code" href="namespaceMB_1_1utils.html#aa419ed339bbdacd4108fb5cc1cd14539">calculateCRC</a>(<span class="keyword">const</span> uint8_t *buff, <span class="keywordtype">size_t</span> len) {</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> uint16_t wCRCTable[] = {</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;      0X0000, 0XC0C1, 0XC181, 0X0140, 0XC301, 0X03C0, 0X0280, 0XC241, 0XC601,</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;      0X06C0, 0X0780, 0XC741, 0X0500, 0XC5C1, 0XC481, 0X0440, 0XCC01, 0X0CC0,</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;      0X0D80, 0XCD41, 0X0F00, 0XCFC1, 0XCE81, 0X0E40, 0X0A00, 0XCAC1, 0XCB81,</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;      0X0B40, 0XC901, 0X09C0, 0X0880, 0XC841, 0XD801, 0X18C0, 0X1980, 0XD941,</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;      0X1B00, 0XDBC1, 0XDA81, 0X1A40, 0X1E00, 0XDEC1, 0XDF81, 0X1F40, 0XDD01,</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;      0X1DC0, 0X1C80, 0XDC41, 0X1400, 0XD4C1, 0XD581, 0X1540, 0XD701, 0X17C0,</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;      0X1680, 0XD641, 0XD201, 0X12C0, 0X1380, 0XD341, 0X1100, 0XD1C1, 0XD081,</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;      0X1040, 0XF001, 0X30C0, 0X3180, 0XF141, 0X3300, 0XF3C1, 0XF281, 0X3240,</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;      0X3600, 0XF6C1, 0XF781, 0X3740, 0XF501, 0X35C0, 0X3480, 0XF441, 0X3C00,</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;      0XFCC1, 0XFD81, 0X3D40, 0XFF01, 0X3FC0, 0X3E80, 0XFE41, 0XFA01, 0X3AC0,</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;      0X3B80, 0XFB41, 0X3900, 0XF9C1, 0XF881, 0X3840, 0X2800, 0XE8C1, 0XE981,</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;      0X2940, 0XEB01, 0X2BC0, 0X2A80, 0XEA41, 0XEE01, 0X2EC0, 0X2F80, 0XEF41,</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;      0X2D00, 0XEDC1, 0XEC81, 0X2C40, 0XE401, 0X24C0, 0X2580, 0XE541, 0X2700,</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;      0XE7C1, 0XE681, 0X2640, 0X2200, 0XE2C1, 0XE381, 0X2340, 0XE101, 0X21C0,</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;      0X2080, 0XE041, 0XA001, 0X60C0, 0X6180, 0XA141, 0X6300, 0XA3C1, 0XA281,</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;      0X6240, 0X6600, 0XA6C1, 0XA781, 0X6740, 0XA501, 0X65C0, 0X6480, 0XA441,</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;      0X6C00, 0XACC1, 0XAD81, 0X6D40, 0XAF01, 0X6FC0, 0X6E80, 0XAE41, 0XAA01,</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;      0X6AC0, 0X6B80, 0XAB41, 0X6900, 0XA9C1, 0XA881, 0X6840, 0X7800, 0XB8C1,</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;      0XB981, 0X7940, 0XBB01, 0X7BC0, 0X7A80, 0XBA41, 0XBE01, 0X7EC0, 0X7F80,</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;      0XBF41, 0X7D00, 0XBDC1, 0XBC81, 0X7C40, 0XB401, 0X74C0, 0X7580, 0XB541,</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;      0X7700, 0XB7C1, 0XB681, 0X7640, 0X7200, 0XB2C1, 0XB381, 0X7340, 0XB101,</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;      0X71C0, 0X7080, 0XB041, 0X5000, 0X90C1, 0X9181, 0X5140, 0X9301, 0X53C0,</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;      0X5280, 0X9241, 0X9601, 0X56C0, 0X5780, 0X9741, 0X5500, 0X95C1, 0X9481,</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;      0X5440, 0X9C01, 0X5CC0, 0X5D80, 0X9D41, 0X5F00, 0X9FC1, 0X9E81, 0X5E40,</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;      0X5A00, 0X9AC1, 0X9B81, 0X5B40, 0X9901, 0X59C0, 0X5880, 0X9841, 0X8801,</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;      0X48C0, 0X4980, 0X8941, 0X4B00, 0X8BC1, 0X8A81, 0X4A40, 0X4E00, 0X8EC1,</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;      0X8F81, 0X4F40, 0X8D01, 0X4DC0, 0X4C80, 0X8C41, 0X4400, 0X84C1, 0X8581,</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;      0X4540, 0X8701, 0X47C0, 0X4680, 0X8641, 0X8201, 0X42C0, 0X4380, 0X8341,</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;      0X4100, 0X81C1, 0X8081, 0X4040};</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160; </div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;  uint8_t nTemp;</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;  uint16_t wCRCWord = 0xFFFF;</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160; </div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;  <span class="keywordflow">while</span> (len--) {</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    nTemp = *buff++ ^ wCRCWord;</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    wCRCWord &gt;&gt;= 8;</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    wCRCWord ^= wCRCTable[nTemp];</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;  }</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;  <span class="keywordflow">return</span> wCRCWord;</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;}</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160; </div>
<div class="line"><a name="l00258"></a><span class="lineno"><a class="line" href="namespaceMB_1_1utils.html#a102e7bc4008a2658a5db76a9b70bec97">  258</a></span>&#160;<span class="keyword">inline</span> uint16_t <a class="code" href="namespaceMB_1_1utils.html#aa419ed339bbdacd4108fb5cc1cd14539">calculateCRC</a>(<span class="keyword">const</span> std::vector&lt;uint8_t&gt; &amp;buffer) {</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="namespaceMB_1_1utils.html#aa419ed339bbdacd4108fb5cc1cd14539">calculateCRC</a>(buffer.begin().base(), buffer.size());</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;}</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;} <span class="comment">// namespace MB::utils</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespaceMB_1_1utils_html_af467d314367c209ef830b2ae97393b6f"><div class="ttname"><a href="namespaceMB_1_1utils.html#af467d314367c209ef830b2ae97393b6f">MB::utils::mbErrorCodeToStr</a></div><div class="ttdeci">std::string mbErrorCodeToStr(MBErrorCode code) noexcept</div><div class="ttdoc">Converts Modbus error code to it's string representation.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:72</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_aa419ed339bbdacd4108fb5cc1cd14539"><div class="ttname"><a href="namespaceMB_1_1utils.html#aa419ed339bbdacd4108fb5cc1cd14539">MB::utils::calculateCRC</a></div><div class="ttdeci">uint16_t calculateCRC(const uint8_t *buff, size_t len)</div><div class="ttdoc">Calculates CRC.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:214</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_a2057e90dfbefb2bc7cea23f6140d5a04"><div class="ttname"><a href="namespaceMB_1_1utils.html#a2057e90dfbefb2bc7cea23f6140d5a04">MB::utils::bigEndianConv</a></div><div class="ttdeci">uint16_t bigEndianConv(const uint8_t *buf)</div><div class="ttdoc">Create uint16_t from buffer of two bytes, ex. { 0x01, 0x02 } =&gt; 0x0102.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:208</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_a7aa22230ea192f06612fbc809fca2335"><div class="ttname"><a href="namespaceMB_1_1utils.html#a7aa22230ea192f06612fbc809fca2335">MB::utils::isStandardErrorCode</a></div><div class="ttdeci">bool isStandardErrorCode(MBErrorCode code)</div><div class="ttdoc">Checks if error code is modbus standard error code.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:46</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_a8098c5bcb6c33b219bafdee42334e260"><div class="ttname"><a href="namespaceMB_1_1utils.html#a8098c5bcb6c33b219bafdee42334e260">MB::utils::MBFunctionRegisters</a></div><div class="ttdeci">MBFunctionRegisters</div><div class="ttdoc">Simplified register types.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:156</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_aa8ebb89b73bf4d0e3485b6341a50f116"><div class="ttname"><a href="namespaceMB_1_1utils.html#aa8ebb89b73bf4d0e3485b6341a50f116">MB::utils::MBFunctionCode</a></div><div class="ttdeci">MBFunctionCode</div><div class="ttdoc">All modbus standard function codes + Undefined one.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:114</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_a0b3590994f5ba26cd61929f5a394ab70"><div class="ttname"><a href="namespaceMB_1_1utils.html#a0b3590994f5ba26cd61929f5a394ab70">MB::utils::MBFunctionType</a></div><div class="ttdeci">MBFunctionType</div><div class="ttdoc">Simplified function types.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:134</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_ab24a81a029cf6c4765eab5d74b7d8dff"><div class="ttname"><a href="namespaceMB_1_1utils.html#ab24a81a029cf6c4765eab5d74b7d8dff">MB::utils::functionType</a></div><div class="ttdeci">MBFunctionType functionType(const MBFunctionCode code)</div><div class="ttdoc">Checks &quot;Function type&quot;, according to MBFunctionType.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:137</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html"><div class="ttname"><a href="namespaceMB_1_1utils.html">MB::utils</a></div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:18</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_aa34c557c9bf4c6bfeb86aa16b398de55"><div class="ttname"><a href="namespaceMB_1_1utils.html#aa34c557c9bf4c6bfeb86aa16b398de55">MB::utils::MBErrorCode</a></div><div class="ttdeci">MBErrorCode</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:22</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_ad967d0ef18fecbc1a231143db3793991"><div class="ttname"><a href="namespaceMB_1_1utils.html#ad967d0ef18fecbc1a231143db3793991">MB::utils::functionRegister</a></div><div class="ttdeci">MBFunctionRegisters functionRegister(const MBFunctionCode code)</div><div class="ttdoc">Get register type based on function code.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:164</div></div>
<div class="ttc" id="anamespaceMB_1_1utils_html_aaf546a5a9bb27ee4f7300064d18d9a9e"><div class="ttname"><a href="namespaceMB_1_1utils.html#aaf546a5a9bb27ee4f7300064d18d9a9e">MB::utils::mbFunctionToStr</a></div><div class="ttdeci">std::string mbFunctionToStr(MBFunctionCode code) noexcept</div><div class="ttdoc">Converts modbus function code to its string represenatiton.</div><div class="ttdef"><b>Definition:</b> modbusUtils.hpp:184</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.19
</small></address>
</body>
</html>
